package birdsong.dummy;

import birdsong.comm.ServerComm;
import birdsong.comm.ServerSideMessage;
import birdsong.server.BirdsongServer;

public class BirdsongServerDummy implements BirdsongServer {

	@Override
	public void start(ServerComm serverComm) {
		serverComm.start();
		
		while (true) {
			ServerSideMessage message = serverComm.getNextMessage();
			
			if (message.getType() == ServerSideMessage.Type.BIRDSONG_MESSAGE) {
				serverComm.sendBirdsongMessage(message.getClientNickname(), 
											   message.getClientNickname(), 
											   "You said: " + message.getPayload());
			}
		}
	}

}
